package com.bruce.pattern.behavioral.state;

/**
 * Created by bruce on 2018/11/11 21:00
 */
public class VideoContext implements VideoState{

    public final static PlayState PLAY_STATE = new PlayState();
    public final static StopState STOP_STATE = new StopState();
    public final static SpeedState SPEED_STATE = new SpeedState();

    private AbsVideoState videoState;

    public VideoState getVideoState() {
        return videoState;
    }

    public void setVideoState(AbsVideoState videoState) {
        this.videoState = videoState;
        videoState.setVideoContext(this);
    }

    @Override
    public void play() {
        videoState.play();
    }

    @Override
    public void speed() {
        videoState.speed();
    }

    @Override
    public void stop() {
        videoState.stop();
    }
}
